<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>房联行增值服务部后台管理中心</title>
		<meta name="renderer" content="webkit">
		<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
		<meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
		<link rel="stylesheet" href="./css/font.css">
		<link rel="stylesheet" href="./css/xadmin.css">
		<script type="text/javascript" src="js/jquery.min.js"></script>
		<script type="text/javascript" src="./lib/layui/layui.js" charset="utf-8"></script>
		<script type="text/javascript" src="./js/xadmin.js"></script>
		<!-- 让IE8/9支持媒体查询，从而兼容栅格 -->
		<!--[if lt IE 9]>
      <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
      <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
	</head>
	<body>
		<div class="x-body">
			<div class="x-nav">
		      	<span class="layui-breadcrumb">
			        <a href="">首页</a>
			        <a href="javascript:;">图片库管理</a>
			        <a>
			          <cite>添加套图</cite>
			        </a>
		      	</span>
			    <a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right" href="javascript:location.replace(location.href);" title="刷新">
			        <i class="layui-icon layui-icon-refresh-1" style="line-height:30px"></i>
			    </a>
    		</div>
			<form class="layui-form">
				<div class="layui-row" style="padding: 30px;">
				    <div class="layui-col-xs6">
				    	<h1 class="font18">图片信息    <span style=" padding-left:40px;font-size: 18px;">ID:35844522</span>
				    	<button class="layui-btn layui-btn-sm" lay-filter="add" lay-submit="" id="addfrom" style=" padding: 0px 20px; border-radius:5px; margin-left:80px;">编辑</button>
				    	</h1>
				    </div>
				    <div class="layui-col-xs6"></div>
				</div>
				
				<div class="layui-row">
				    <div class="layui-col-xs6" style=" padding:0px 30px;">
				    	
				    	<div class="layui-form-item ">
				    		<label for="desc" class="layui-form-label" style="width: 100px;"><span class="x-red">*</span>设计机构名称：</label>
							<div class="layui-input-inline w240" >
								<select name="ad-space">
						        <option value="">全部</option>
						        <option value="风格1" selected="">风格1</option>
						        <option value="风格2">风格2</option>
						        <option value="风格3">风格3</option>
						    </select>
							</div>
				    	</div>
				    	
				    	
				    	<div class="layui-form-item">
							<label for="desc" class="layui-form-label" style="width: 100px;"><span class="x-red">*</span>图片类型：</label>
							<div class="layui-input-inline">
								<input type="text" id="desc" name="desc" placeholder="定制图" required="" lay-verify="required" autocomplete="off" class="layui-input w240">
							</div>
						</div>
						<div class="layui-form-item">
							<label for="desc" class="layui-form-label" style="width: 100px;">标题：</label>
							<div class="layui-input-inline">
								<input type="text" id="desc" name="desc" placeholder="如：现代简约二居室" required="" lay-verify="required" autocomplete="off" class="layui-input w240">
							</div>
						</div>
						<div class="layui-form-item">
							<label for="desc" class="layui-form-label" style="width: 100px;">风格：</label>
							<div class="layui-input-inline">
								<input type="text" id="desc" name="desc" placeholder="如：现代" required="" lay-verify="required" autocomplete="off" class="layui-input w240">
							</div>
						</div>
						<div class="layui-form-item">
							<label for="desc" class="layui-form-label" style="width: 100px;">空间：</label>
							<div class="layui-input-inline">
								<input type="text" id="desc" name="desc" required="" lay-verify="required" autocomplete="off" class="layui-input w240">
							</div>
						</div>
						
				    </div>
				    <div class="layui-col-xs6">
				    	<div class="layui-form-item">
							<label for="link" class="layui-form-label">图片：</label>
							<div class="layui-input-inline">
								<div class="layui-form-item">
									<img class="layui-upload-img" id="banner_show" width="190" src="images/banner.png">
									<p id="demoText"></p>
						    	</div>
								<div class="layui-input-inline" >
									<select name="ad-space">
								        <option value="">请选择</option>
								        <option value="客厅" selected="">客厅</option>
								        <option value="卧室">卧室</option>
								        <option value="吧台">吧台</option>
							    	</select>
								</div>
				    	
						    	
								<label class="layui-form-label"></label>
								<button type="button" class="layui-btn" id="banner" style="width: 190px;"><i class="layui-icon"></i>选择上传文件</button>
								<div class="layui-input-inline w320" style=" padding: 20px 0px;color: #999;">只能上传jpg/png格式文件，文件不能超过XXkb</div>
							</div>
							
							<div class="layui-form-item">
								<label for="desc" class="layui-form-label">排序：</label>
								<div class="layui-input-inline">
									<input type="text" id="Sort" name="Sort" required="" lay-verify="required" autocomplete="off" class="layui-input">
								</div>
						    </div>
							
							
						</div>	
				    </div>
				</div>
				
			</form>
		</div>
		<script>
			layui.use(['form', 'layer', 'element', 'upload'], function() {
				var $ = layui.jquery
				var form = layui.form,
				layer = layui.layer,
				upload = layui.upload;	
				//普通图片上传
				var uploadInst = upload.render({
					elem: '#banner',
					url: '/upload/'
					,before: function(obj) {
						//预读本地文件示例，不支持ie8
						obj.preview(function(index, file, result) {
							$('#banner_show').attr('src', result); //图片链接（base64）
						});
					},
					done: function(res) {
						//如果上传失败
						if(res.code > 0) {
							return layer.msg('上传失败');
						}
						//上传成功
					},
					error: function() {
						//演示失败状态，并实现重传
						/*var demoText = $('#demoText');
						demoText.html('<span style="color: #FF5722;">上传失败</span> <a class="layui-btn layui-btn-mini demo-reload">重试</a>');
						demoText.find('.demo-reload').on('click', function() {
							uploadInst.upload();
						});*/
					}
				});
			  //监听指定开关
			  form.on('switch(switchTest)', function(data){
			    /*layer.msg('开关checked：'+ (this.checked ? 'true' : 'false'), {
			      offset: '6px';
			    });*/
			   
			  });
				//监听提交
				form.on('submit(add)', function(data) {
					console.log(data);
					//发异步，把数据提交
					layer.alert("添加成功", {
						icon: 6
					}, function() {
						// 获得frame索引
						var index = parent.layer.getFrameIndex(window.name);
						//关闭当前frame
						parent.layer.close(index);
					});
					return false;
				});
			});
		</script>
		<script>
			layui.use('laydate', function() {
				var laydate = layui.laydate;
				//常规用法
				laydate.render({
					elem: '#datetime'
				});
			});	
		</script>
	</body>
</html>